package cn.itcast.controller;

import cn.itcast.pojo.User;
import cn.itcast.uservice.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.sql.DataSource;

/**
 * @Author: taft
 * @Date: 2018-9-23 9:29
 */
@RestController
public class HelloController {

    @Autowired
    private UserService userService;

    @GetMapping("hello/{id}")
    public User sayHello(@PathVariable("id") Long id){
        return userService.queryById(id);
    }

    @GetMapping("bye")
    public String sayBye(String name){
        return "hello "+name;
    }
}
